package queue

import (
	"context"
	"encoding/json"
	"fmt"
	"test/redis"
)

/**
 * 生产者
 */
type Product struct {}

/**
 * 抛队列
 */
func (p *Product) Send(job interface{}, queueName string) error {
	fmt.Printf("抛队列: %s, %v\n", queueName, job)

	var redisCli = redis.Instance()
	jsonJob, _ := json.Marshal(&job)
	return redisCli.LPush(context.Background(), queueName, jsonJob).Err()
}